<?php
ini_set('error_reporting',E_ALL|E_STRICT);
ini_set('display_errors',true);

require('../lib/SocuteTemplate.php');

$tpl1 = new SocuteTemplate('sample01.tpl');

$tpl1->set('title', 'Hello World from SoCuTE');

$header = $tpl1->makeSection('header');
$row1 = $tpl1->makeSection('row');
$userWithInfo1 = $tpl1->makeSection('userWithInfo');
$userWithInfo1->set('name','Agus');
$userWithInfo1->set('dob','1990-01-01');
$userWithInfo1->set('gender','male');
$userWithInfo1->set('city','Jakarta');

$userWithInfo2 = $tpl1->makeSection('userWithInfo');
$userWithInfo2->set('name','Rihana');
$userWithInfo2->set('dob','1992-12-12');
$userWithInfo2->set('gender','female');
$userWithInfo2->set('city','Bandung');

$row2 = $tpl1->makeSection('row');
$userWithoutInfo = $tpl1->makeSection('userWithoutInfo');
$userWithoutInfo->set('name','John');

// dispatching sections
$tpl1->dispatch($header);
$tpl1->dispatch($row1);
  $row1->dispatch($userWithInfo1);
  $row1->dispatch($userWithInfo2);
$tpl1->dispatch($row2);
  $row2->dispatch($userWithoutInfo);

$tpl1->defaultWriter->buffered = true;
$tpl1->render();
echo $tpl1->defaultWriter->flushBuffer();
?>
